#include "Employee.h"
#include <iostream>
#include <string>
#include <c++/4.8.3/cstring>

using namespace std;

int Employee::employeeCounter = 100;

Employee::Employee() {
    char namestr[50];
    cout<<"请输入下一个雇员的姓名："<<endl;
    cin>>namestr;
    name = new char[strlen(namestr) + 1];
    strcpy(name,namestr);
    individualEmpNo = employeeCounter++;
    grade=1;
    accumPay=0.0;
};

Employee::~Employee() {
    delete[] name;
}

void Employee::pay() {

}

void Employee::promote(int increment) {
    grade += increment;
}

Technician::Technician() {
    hourlyRate = 100;
}

void Technician::pay() {
    cout<<"请输入"<<name<<"本月的工作时数：";
    cin>>workHours;
    accumPay = hourlyRate * workHours;
    cout<<"兼职技术人员"<<name<<"编号"<<individualEmpNo<<"本月工资"<<accumPay<<endl;
};

void Technician::displayStatus() {
    cout<<"兼职技术人员"<<name<<"编号"<<individualEmpNo<<"级别为"<<grade<<"级，已付工资"<<endl;
}

Salesman::Salesman() {
    commRate=0.004;
}

void Salesman::pay() {
    cout<<"请输入"<<name<<"本月的售票额：";
    cin>>sales;
    accumPay = sales * commRate;
    cout<<"推销员"<<name<<"编号"<<individualEmpNo<<"本月工资"<<accumPay<<endl;
}

void Salesman::displayStatus() {
    cout<<"推销员"<<name<<"编号"<<individualEmpNo<<"级别为"<<grade<<"级，已付工资"<<endl;
}

